package com.killer.serializer;

import java.io.IOException;

/**
 * 序列化顶级接口
 */
public interface Serializer {

    /**
     * 将对象转化为字节数组
     * @param object
     * @return
     * @throws IOException
     */
    public byte[] serialize(Object object) throws IOException;


    /**
     * 将字节数组反序列化成对应的对象
     * @param clazz
     * @param bytes
     * @param <T>
     * @return
     * @throws IOException
     */
    public <T> T deserialize(Class<T> clazz, byte[] bytes) throws IOException;
}
